-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deli read client fixes #9925
Deli read client fixes #9925
Conversation
@@ -40,5 +59,15 @@ export interface IClientManager { | |||
* Returns all clients currently connected including a keep alive time. | |||
* Should be used with delis read only client functionality. | |||
*/ | |||
getTimedClients?(tenantId: string, documentId: string): Promise<Map<string, ITimedClient>>; | |||
getSequencedClients?(tenantId: string, documentId: string): Promise<Map<string, ISequencedSignalClient>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSequencedClients
and extendSequencedClients
are both optional, so that's why I think we did not have to immediately update the Redis ClientManager (and other test implementations) to include these. If r11s or FRS want to enable this new set of features being added for read clients, I assume we would have to provide an implementation, correct?
Also, let's say we mistakenly enabled this new set of read client features (I think we had a setting for that in the other PR). Since getSequencedClients
and extendSequencedClients
are both optional, our build would not break if we do not provide an implementation. But how would the service behave in that case?
In other words, I'm just concerned that if we check this in without providing concrete implementations to getSequencedClients
and extendSequencedClients
, we might later forget about them when we enable the read client feature, and we won't have a build error blocking us to make us realize that issue.
Would you say it is a good idea to make extendSequencedClients
and possibly getSequencedClients
be mandatory, and include implementations of that as part of this PR? I can also help with that.
@pradeepvairamani @znewton can you also take a look at this and let me know if I'm missing something from our side? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you would need to implement these in order to use this new read client stuff.
I could make the methods required and cause them to throw "Not Implemented" errors for now. That way you would be required to implement them when moving to this system since you would get errors when trying to use it. Would that work?
Since I don't use any of the RedisClientManager / test client manager code, I don't think I should be the one to implement those methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes total sense. We will follow up later to provide the actual implementations in Redis ClientManager. For now, having the "Not Implemented" error thrown is already helpful as we will definitely see it happening if we enable the Deli read client feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @GaryWilber ! I ran r11s in Docker using your repo fork/branch and can confirm all works as expected (while the feature is disabled). And later, when we enable it, we should see the error messages in the Redis ClientManager, reminding us to implement the required methods.
Follow up on #9191. Ran into a few issues once I started extensive testing in Push.
The
ExtendClient
control message had a few issues:lastUpdateTime
property, which was set toDate.now()
when theExtendClient
message shows up. While this does work, it's kind of annoying. If delisclientTimeout
was updated, it was possible for it to immediately cause all read clients to be kicked out. I would rather theclientTimeout
time to only take effect the next time the client was extended.readClients
map. However it didn't update the expiration time for the client that's in the database (Redis), which is managed byClientManager
. That means a kafka rebalance, which recreates the deli lambda, would fail to see that the client was extended since it's reading the clients from redis on startup.Fixes for each of the above issues:
lastUpdateTime
withexp
time. This also aligns more with how Redis expiration times work.ClientManager
is now passed to deli and it contains anextendClients
method. Deli will call that when the control message shows up. The method should extend the TTL of the clients in Redis and update theexp
property for the deli client objects. Deli will also now keep track of the sequence numbers within theReadClient
object. That makes the Redis commands to extend the client simpler (no longer needs to fetch the existing client object).Other fixes / changes:
ITimedClient
toISequencedSignalClient
to better align with the naming scheme of things inClientManager
.Extra notes for reference:
ExtendClient
messages to deliISequencedSignalClient
object as is.